Ensuring properly ordered events in a distributed computing environment

ABSTRACT

A first event occurs at a first computer at a first time, as measured by a local clock. A second event is initiated at a second computer by sending a message that includes the first time. The second event occurs at a second time, as measured by a local clock. Because of clock error, the first time is later than the second time. Based on the first time being later than the second time, an alternate second time, that is based on the first time, is used as the time of the second event. When a third system determines the order of the two events, the first time is obtained from the first computer, and the alternate second time is obtained from the second computer, and the order of the events is determined based on a comparison of the two times.

PRIORITY CLAIM

This application is a continuation application of U.S. patentapplication Ser. No. 16/895,947, entitled “ENSURING PROPERLY ORDEREDEVENTS IN A DISTRIBUTED COMPUTING ENVIRONMENT,” filed Jun. 8, 2020,which is a continuation application of U.S. patent application Ser. No.16/198,677, entitled “ENSURING PROPERLY ORDERED EVENTS IN A DISTRIBUTEDCOMPUTING ENVIRONMENT,” filed on Nov. 21, 2018 (now U.S. Pat. No.10,681,190), which is a continuation of U.S. patent application Ser. No.14/462,445, entitled “ENSURING PROPERLY ORDERED EVENTS IN A DISTRIBUTEDCOMPUTING ENVIRONMENT,” filed on Aug. 18, 2014 (now U.S. Pat. No.10,171,635), which claims to the benefit of U.S. Provisional PatentApplication No. 61/911,720, entitled “HYBRIDTIME AND HYBRIDCLOCKS FORCLOCK UNCERTAINTY REDUCTION IN A DISTRIBUTED COMPUTING ENVIRONMENT”,filed on Dec. 4, 2013; all documents are incorporated by referenceherein in their entirety.

BACKGROUND

In general, it is difficult to have an accurate measurement of absolutetime in a distributed computing environment. Even with timesynchronization mechanisms such as Network Time Protocol (NTP, anetworking protocol for clock synchronization between networked computersystems), guaranteeing global consistency across distributed computingenvironments with uncertain physical clocks remains a problem. Whilesynchronizing the clock of each computer in a network to the samereference clock, such as an atomic clock, will reduce the error in timesreported by the clocks, it will not eliminate the error. For example,the longer a clock runs without synchronization, the more the clock'stime drifts away from the reference clock time, and the larger the errorbecomes between the two clocks. Even with synchronization, the error istoo large to ignore in many cases.

Further, when synchronizing the time, an uncertain network delay existsfrom the system sending the reference clock time and the systemreceiving the reference time. A system may send a request for areference time to a reference system, and may receive a response in 50milliseconds (ms). The reference time is the time at some point in the50 ms time window, but it is difficult to know at which point exactly.Some systems will assume that the reference time is the time at thehalf-way point of the round trip message (i.e. at 25 ms in the example),and will add 25 ms to the reference time to obtain the “current” time.However, this is an approximation with some unknown, albeit bounded(e.g. 50 ms), error. Nonetheless, even with a system such as NTP, anyclock of any computer in a distributed computing environment may havesome unknown, but generally bounded, error.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of a technique will be described and explained through theuse of the accompanying drawings in which:

FIG. 1 is a system diagram illustrating a distributed computingenvironment, consistent with various embodiments;

FIG. 2 is an activity diagram illustrating a method for determining theorder of events in a distributed computing environment, consistent withvarious embodiments;

FIG. 3 is a diagram illustrating a sequence of events where some arecausally related, consistent with various embodiments; and

FIG. 4 is a high-level block diagram showing an example of a computersystem in which at least some operations described in the descriptionsof the above figures can be implemented, consistent with variousembodiments.

DETAILED DESCRIPTION

The following description and drawings are illustrative and are not tobe construed as limiting. Numerous specific details are described toprovide a thorough understanding of the disclosure. However, in certaininstances, well-known or conventional details are not described in orderto avoid obscuring the description. References to one or an embodimentin the present disclosure can be, but not necessarily are, references tothe same embodiment; and, such references mean at least one of theembodiments.

Reference in this specification to “one embodiment” or “an embodiment”means that a particular feature, structure, or characteristic describedin connection with the embodiment is included in at least one embodimentof the disclosure. The appearances of the phrase “in one embodiment” invarious places in the specification are not necessarily all referring tothe same embodiment, nor are separate or alternative embodimentsmutually exclusive of other embodiments. Moreover, various features aredescribed which may be exhibited by some embodiments and not by others.Similarly, various requirements are described which may be requirementsfor some embodiments but not other embodiments.

In this description, the term “cause” and variations thereof refer toeither direct causation or indirect causation. For example, a computersystem can “cause” an action by sending a message to a second computersystem that commands, requests, or prompts the second computer system toperform the action. Any number of intermediary devices may examineand/or relay the message during this process. In this regard, a devicecan “cause” an action even though it may not be known to the devicewhether the action will ultimately be executed.

The terms used in this specification generally have their ordinarymeanings in the art, within the context of the disclosure, and in thespecific context where each term is used. Certain terms that are used todescribe the disclosure are discussed below, or elsewhere in thespecification, to provide additional guidance to the practitionerregarding the description of the disclosure. For convenience, certainterms may be highlighted, for example using italics and/or quotationmarks. The use of highlighting has no influence on the scope and meaningof a term; the scope and meaning of a term is the same, in the samecontext, whether or not it is highlighted. It will be appreciated thatsame thing can be said in more than one way.

Consequently, alternative language and synonyms may be used for any oneor more of the terms discussed herein, nor is any special significanceto be placed upon whether or not a term is elaborated or discussedherein. Synonyms for certain terms are provided. A recital of one ormore synonyms does not exclude the use of other synonyms. The use ofexamples anywhere in this specification including examples of any termsdiscussed herein is illustrative only, and is not intended to furtherlimit the scope and meaning of the disclosure or of any exemplifiedterm. Likewise, the disclosure is not limited to various embodimentsgiven in this specification.

Without intent to further limit the scope of the disclosure, examples ofinstruments, apparatus, methods and their related results according tothe embodiments of the present disclosure are given below. Note thattitles or subtitles may be used in the examples for convenience of areader, which in no way should limit the scope of the disclosure. Unlessotherwise defined, all technical and scientific terms used herein havethe same meaning as commonly understood by one of ordinary skill in theart to which this disclosure pertains. In the case of conflict, thepresent document, including definitions will control.

This description introduces technology for ensuring that events areproperly ordered in a distributed computing environment. In one example,a person is an anti-government activist in a foreign country, and theactivist uses a social media platform to help promote hisanti-government activism. The activist's activities have already createdproblems for the activist, and he has had to relocate to another countryfor his safety. To help the activist stay informed as to governmentactivities, the activist “friended” a government official at the socialmedia platform, so that he could see the activities of the governmentofficial at the social media platform. At this social media platform,when a first person is a “friend” of a second person, the user accountof the first person is linked as a friend via a database (the “friendsdatabase (DB)”) to the user account of the second person.

The activist is about to post an anti-government message to the socialmedia platform. However, the activist does not want the governmentofficial to be able to see the message, so the activist “unfriends” thegovernment agent before posting the anti-government message. At thissocial media platform, when a first user “unfriends” a second user, thefriend link between the first user's account and the second user'saccount is removed, and each of the two users are no longer able to seeany activities of the other user that happen after the unfriending, andthat are visible to only friends of the user. Naturally, the activistexpects the unfriending to take effect before the posting of themessage. He similarly expects that the government official will not beable to see the anti-government message (as the anti-government messagehas a security setting that limits access to the message to only theactivist's friends at the social media platform).

When the activist unfriends the government official, he utilizes hislocal computer to access the social media platform and execute anunfriend command. This causes an unfriend command to be sent to a remotecomputer that maintains the friends DB (the “friends DB computer”). Thefriends DB computer unfriends (i.e. removes the friend link between) thegovernment official's user account and the activist's user account, andupdates the friends DB with the time of the unfriending, which is1:00:00 pm GMT according to the clock of the friends DB computer.

When the activist posts the anti-government message, he wants to post itto a group in his home country. He once again utilizes his localcomputer to access the social media platform, and he executes a postcommand to post the anti-government message. This causes a post commandto be sent to a remote computer that is located in his home country (the“posting computer”). The posting computer receives the post command, andenters the post in a posts DB, along with a time entry of the post,which happens to be 12:59:59 pm GMT according to the local clock of theposting computer. At the time of the posting, due to inaccuracy/error ofthe clocks of the friends DB computer and the posting computer, theclock of the friends DB computer is running faster than the clock of theposting computer by a few seconds. As a result, even though the postinghappened after the unfriending, according to the local clocks of thefriends DB computer and the posting computer, the post incorrectlyappears to have happened before the unfriending.

When the government official accesses the social media platform, theplatform begins the process of determining what to display for thegovernment official. The social media platform, based on data from thefriends DB computer, determines that the government official was friendswith the activist until 1:00:00 pm GMT. The platform, based on data fromthe posting computer, determines that the activist posted theanti-government message at 12:59:59 pm GMT. If the platform had nosolution to account for clock error, the platform could erroneouslydetermine that the posting of the anti-government message happenedbefore the unfriending, and could allow the government official tomistakenly view the anti-government message, with possible seriousconsequences for the activist.

One way to solve this problem is with a “commit wait” solution. Asdiscussed above, while the error between any two clocks of a distributedcomputing environment may be unknown, it may also be bounded. Forexample, the error bound between any two clocks may be 5 seconds. Inother words, the maximum error between any two clocks of computers ofthe distributed computing environment is less than 5 seconds. If theactivist executes the unfriend command, and then is prevented fromexecuting the post command for a time period greater than the errorbound (e.g. 5 seconds), the local time of the post command will be laterthan the local time of the unfriend command. This is true even when theclock of the computer that executes the post command is running themaximum 5 seconds earlier than the clock of the computer that executesthe unfriend command. However, this solution requires every user to waita time longer than the error bound time between commands where orderingof events matters, which may frustrate many users.

Utilizing the disclosed technology, proper ordering of events, such asthe unfriending and the posting of the above example, can be maintained.In one embodiment, as applied to the above example, after the friends DBcomputer unfriends the government official's user account and theactivist's user account, and updates the friends DB with the time of theunfriending, the friends DB computer's response to the activist's localcomputer includes a message that includes the time of the unfriending(i.e. 1:00:00 pm GMT), and a logical value associated with theunfriending time.

When the activist posts the anti-government message, in addition tosending the anti-government message to the posting computer, theactivist via the social media platform also sends the time of andlogical value associated with the unfriending, that were received fromthe friends DB computer. When the posting computer receives the postcommand and enters the post in the posts DB, instead of automaticallyupdating the friends DB using the time from the clock of the postingcomputer to indicate the time that the posting occurred, the postingcomputer does something different. The posting computer compares theunfriending time that was received along with the anti-governmentmessage, and the time of the local clock, which happens to be 12:59:59pm GMT. The comparison determines that the local time is earlier thanthe unfriending time, so the posting computer updates the posts DB withthe unfriending time (i.e. with 1:00:00 pm GMT) as the time that theanti-government message was posted. Additionally, the posting computerincrements the logical value associated with unfriending time, and alsoupdates the posts DB with the incremented logical value that isassociated with the time of the posting.

Without changing its local clock, the posting computer generatestimestamps for new transactions that are the same time or later thanreceived timestamps, such as the received timestamp of the time of theunfriending. If its local clock reads a time earlier than a receivedtimestamp, the posting computer uses the time of the received timestampas the time for a new event, and increments the logical value that isassociated with the time for the new event. The combination of thetimestamp and the associated logical value enable unique, incrementalvalues for the timestamps of each event.

When the government official accesses the social media platform, theplatform begins the process of determining what to display for thegovernment official. The platform, based on data from the friends DBcomputer, determines that the government official was friends with theactivist until 1:00:00 pm GMT, and also determines the associatedunfriending logical value. The platform, based on data from the postingcomputer, determines that the activist posted the anti-governmentmessage at 1:00:00 pm GMT, and also determines the associated postinglogical value. After comparing the two times and determining that bothare the same time, the posting computer next compares the logical valuesassociated with each of the two times. This comparison determines thatthe unfriending logical value is lower than the posting logical value,and that therefore the unfriending happened before the posting.Resultantly, the platform determines that the government official wasnot a friend of the activist at the time of the posting, and that thegovernment official should not be allowed to view the anti-governmentmessage.

Turning to the figures, FIG. 1 is a system diagram illustrating adistributed computing environment, consistent with various embodiments.In the example distributed computing environment of FIG. 1, distributedcomputing environment 100 includes first user device 110 with localclock 130, second user device 115 with local clock 135, first server 120with local clock 140, and second server 125 with local clock 145, whichare all networked together via network 180, which can be or include anyof the Internet, a local area network (LAN), a wide area network (WAN),one or more wireless networks (e.g., a WiFi network and/or a cellulartelecommunications network), etc. In the example of FIG. 1, first userdevice 110 is possessed by first user 105, and second user device 115 ispossessed by second user 155.

In general, it is difficult for a process in a distributed computingenvironment, such as distributed computing environment 100, to have anaccurate measurement of absolute physical time. Even with timesynchronization mechanisms/processes, such as NTP, running on differentmachines in a distributed computing environment, such as running ondevices 110-115 and/or servers 120-125 in distributed computingenvironment 100, the clocks of the various machines may have someinaccuracy and suffer some error compared to an unknown theoreticalreference clock. For example, the times reported by each of clocks130-145 can have some inaccuracy and error as compared to a theoreticalreference clock. Additionally, real-life clocks, such as clocks 130-145,exhibit skew over time: clocks on different machines may drift fartherapart from each other as time progresses. This can result in eventswhich occur in a certain order appearing to occur in a different orderwhen the times of the events, which are based on local inaccurateclocks, are compared.

For example, a first event occurs on first server 120, and a secondevent occurs on second server 125 at a later time. However, becauselocal clock 145 has error and reports a time earlier than local clock140, local clock 145, when the second event occurs, can report anearlier time than local clock 140 reported when the first eventoccurred. When the two times are compared, the time of the first event,as reported by local clock 140, can be a later time than the time of thesecond event, as reported by local clock 145. Resultantly, one coulderroneously determine, based on the reported times, that the first eventoccurred after the second event.

Logical Clocks

One way to address the inaccuracy of physical clocks, such as clocks130-145, is to employ logical clocks. Logical clocks can ignore anyphysical clock provided by the system, and can instead create asurrogate notion of logical time in which certain ordering propertiesare made to hold. In particular, if a process observes (or triggers) oneevent e, such as the unfriending of the example of the summary, and thentriggers a second event f based on the results of e, such as the postingof the anti-government message of the above example, then e is said tohave happened before f and the logical timestamp of e must be less thanthat of f according to some partial order relation.

In order to preserve and/or track any kind of logical happened beforerelation there is the need to propagate some information along with themessages, be it the form of numeric timestamps, vectors of numerictimestamps, or even matrices of timestamps. Such information can also berelayed to and by third parties in order to preserve correctness. Thisis often hard if not generally difficult to guarantee.

Though logical clocks can provide for consistent snapshots, such as asnapshot that is consistent across different partitions of a data set,they may lack certain properties which are useful for practitioners; inparticular, a system operator or user may wish to perform a“point-in-time” query in a database system, in which the point in timeis expressed by a physical timestamp. When the database system is basedon logical clocks, there is no physical timestamp nor any absolute timeupon which to base the “point-in-time” query.

Though physical clocks such as clocks 130-145 are inaccurate, it is notnecessary for a software platform to fully ignore them. Rather, if theinaccuracies present in the physical clock can be modeled and bounded,many of the advantages of physical clocks (e.g. point-in-time query andintuitive ordering between events well-separated in physical time) canbe provided while not sacrificing the correct causality trackingprovided by logical timestamps.

Overview of Bounded-Error Clocks

In order to measure and bound the error on a physical clock, a model forthe error can be developed for the underlying system. The following isone example of such a model:t=t _(u)±ϵ_(u)+(1±λ)(RTT _(s) +Δt _(p))  (1)

where t_(u) is the timestamp of the upstream server as of the lastsynchronization event, ϵ_(u) is the error bound on the upstream server,RTT_(s) is the round-trip time taken to perform the lastsynchronization, λ is a worst-case estimate of the clock rate skew, andΔt_(p) is the amount of time elapsed since the last synchronizationevent, as measured by the local physical clock. Though the true value ofλ is unknown and may change over time based on ambient conditions suchas temperature, a worst case estimate may be made based on manufacturingtolerances. In some embodiments of a distributed computing environment,such as distributed computing environment 100, a conservative errorbound of 200 ppm can hold even for large populations of systems, such asservers 120-125 and/or devices 110-115.

Application Programming Interfaces (APIs) can be made available tosoftware and software platforms that run on devices and systems, such asdevices 110-115 and servers 120-125, and which can return the currenttime including its error bound to the calling program.

Commit Wait

Another way to address the inaccuracy of physical clocks, such as clocks130-145, is to employ a commit wait system, in which events whose ordermust be properly maintained are forced to happen at times that areseparated by more than the error bound of the clocks. For example, anAPI can be provided to software programs and/or software platforms thatrun on systems of a distributed computing environment, such as devices110-115 and/or servers 120-125 of distributed computing environment 100,and which returns the current time along with an error bound. Thesoftware can use this information to implement a system supporting theconcept of commit wait. For example, a first event occurs on firstserver 120, and a second event, whose order must be properly maintainedwith respect to the first event, is forced to wait an amount of timethat is greater than the error bound before being allowed to be executedon second server 125. By waiting a period of time greater than the errorbound, the time of the second event, as reported by local clock 145, isreliably after the time of the first event, as reported by the localclock 140, regardless as to which systems of the distributed computingenvironment the two events occur.

With commit wait, events can be reliably evaluated to determine theirproper order, even if two participants communicate via a hidden channelwithout propagating timestamps, such as by communicating via acommunication channel that accesses data of a software platform but isoutside of the software platform. Clock propagation happensautomatically for communications that happen via communications channelsthat are within the software platform. In a commit wait system, theordering of events can be preserved in a way which is consistent withphysical time. That is, the time of a first event, as reported by thelocal clock of the system on which the first event occurs, can becompared to the time of a second event, as reported by the local clockof the system on which the second event occurs, and a comparison of thetwo times can be reliably relied upon to indicate the correct eventorder. With a commit wait system, an external message dependentalgorithm (such as logical or vector clocks) can be avoided andobtaining the correct order of events can be accomplished by comparingphysical times.

Through the use of commit wait, proper ordering of events between anytwo write transactions can be preserved. In particular, a commit waitsystem enforces that for any two transactions T₁ and T₂, where e is thecommit event for T₁, and f is the start event for T₂, if T₁ committedbefore T₂ started then PT (e)<PT (f), where PT(x) is the physical timeof event x as reported by the local clock of the system at which event xoccurred. A commit wait system can produce ordering correctness forcausally related transactions, i.e. that any snapshot read will yield aconsistent cut, without sending any messages. The relation enforced by acommit wait system can be illustrated by Definition 1.

Definition 1. The happened before relation is defined as:

A commit wait system can ensure proper event ordering through evaluationof physical time by not releasing a message caused by event e untilenough time has passed that all nodes agree that PT (e) is in the pastby waiting for 2*ϵ before sending any message resulting from e.Enforcing this relation enables physical times to indicate the properordering of events for causally related transactions.

However, such properties come at a price. For one, the transactions aredelayed by, for example, 2*ϵ, where ϵ is the error bound of a singleclock relative to a theoretical reference clock, and 2*ϵ is the errorbound between any two clocks of the distributed computing environment.

Maintaining Event Ordering Using Physical Time

A system based on physical time (the “physical time system”, or “PTS”)overcomes the above discussed shortcomings of logical clock and commitwait systems. Some embodiments of the physical time system rely onphysical time measurement assumptions in order to work. The embodimentsfurther assume that machines, such as devices 110-115 and/or servers120-125, have a reasonably accurate physical clock (also referred to asa local clock), such as local clocks 130-145. The time reported byphysical clocks can be represented by the PC_(i)(t) function, whichoutputs the numeric timestamp returned by the physical clock as read byprocess i at time t, and is able to provide absolute time measurements.This is reasonable to assume since virtually all modern servers areequipped with such a physical clock.

Some embodiments of the physical time system include an underlyingphysical clock synchronization mechanism that keeps the physical clocksacross different servers synchronized with regard to a “reference” time,which can be the time reported by the physical clock of a “reference”server. The “reference” time can be represented by the C(t) function,which outputs the numeric timestamp returned by the “reference” processat time t. Additionally, these embodiments have a clock synchronizationmechanism that is able to provide an error bound, or maximum clockerror, along with each time measurement. The error bound can be denotedby the E_(i)(t) function, which outputs the numeric value c error ofprocess i at time t¹. The error bound can be the maximum error betweenany two physical clocks of computers on the distributed computingenvironment, or between any physical clock of any computer on thedistributed computing environment and the “reference” time. The errorbound between any two physical clocks can be two times the error boundbetween any physical clock and the “reference” time. ¹ E_(i)(t), C(t),PC_(i)(t) are assumed to use the same time resolution, usually milli- ormicroseconds.

Because most distributed computing environments execute timesynchronization daemons, such as NTP, which both synchronizes theserver's clocks and provides a maximum error on the clock error,embodiments of the physical time system that depend on clocks beingsynchronized can be widely useful. Further, some embodiments of thephysical time system make no assumption regarding the actual accuracy ofthe physical clocks. The physical timestamps returned by server'sclocks, such as by local clocks 140-145 of servers 120-125, may have anarbitrarily large, but finite, error, as long as this error's bound isknown. The expected relationship between C(t), PC_(i)(t) and E_(i)(t)can be the following.

Physical Clock Error is Bound∀i,t:|C(t)−PC _(i)(t)|≤E _(i)(t)  (3)

That is, the physical time system can assume that the physical timestampreturned by each server's local clock is within E_(i)(t)=ϵ_(it) of thereference time. Because most clock synchronization mechanisms provide amaximum error with regard to a reference time, the physical time systemcan be widely useful. It is noteworthy that that E_(i)(t) can representdifferent error functions, one per process, and that ϵ_(it) varies fromprocess to process and over time.

The physical time system can further assume that the timestamp returnedby the physical clock is monotonically increasing:

Physical Clock Timestamps are Process-Wise Monotonically Increasing∀i,t ₁ ,t ₂ :t ₁ <t ₂ ⇒PC _(i)(t ₁)≤PC _(i)(t ₂)  (4)

That is, every time a server's local clock is queried for the currenttime it never outputs a value that is less than a previous one. Forexample, every time local clock 140 of first server 120 is queried, itnever outputs a value that is less than the previous value. While thisassumption is not one hundred percent valid, as the clock synchronismmechanism may skip time forward or backward, such cases are rare and canbe easily detected by monitoring the clock synchronization daemonstatus. Servers may choose to decommission themselves or fail-stop upondetection of such an event. Because most clock synchronizationmechanisms adjust clocks by slowing them down or speeding them up overreasonably large periods of time, most physical clocks can be reliedupon to output a value that is greater than the previous one.

The physical time system can further assume that the starting point oferror intervals is also monotonically increasing process-wise. This isrepresented as:

The Starting Point for Error Intervals is Process-Wise MonotonicallyIncreasing∀i,t ₁ ,t ₂ :t ₁ <t ₂ ⇒⇒PC _(i)(t ₁)−E _(i)(t ₁)≤PC _(i)(t ₂)−E _(i)(t₂)  (5)

Most clock synchronization mechanisms support this assumption. When amaximum error bound is calculated at a certain synchronization point,through the swap of messages with a “reference” server, that error boundincreases over time until there is a new synchronization point. Whilethe error bound increases in time, the physical time system can relyupon the error bound to not increase in a proportion that is greaterthan the elapsed time.

Based on these assumptions we can now define a physical time system APIthat, in some embodiments, can be implemented just using each server'slocal clock and the NTP protocol.

Algorithm 1 The Physical Time System API i ← process_id 1: function Now(p, ε) 2:  p ← PC_(i)(now) 3:  ε ← E_(i)(p) 4:  return (p, ε) 5: endfunction 6: function NOWINTERVAL(earliest, latest) 7:  p ← PC_(i)(now)8:  ε ← E_(i)(p) 9:  earliest ← p − ε 10:  latest ← p + ε 11:  return(earliest, latest) 12: end function

The Physical Time-Stamp Clock

FIG. 2 is an activity diagram illustrating a method for determining theorder of events in a distributed computing environment, consistent withvarious embodiments. The method of the example of FIG. 2 is based on atime-stamp version of a physical time system. The example of the summarywill be used to help explain the method illustrated in FIG. 2, whichstarts with first user device 110 sending a message to initiate a firstevent to first server 120 (step 205). The first event can be, forexample, the unfriending of the example of the summary.

First server 120 processes the first event (step 215) by, e.g.,executing the unfriend command. As part of processing the unfriendcommand, first server 120 updates the friends DB to remove a friend linkbetween an account of first user 105 and an account of second user 155.First server 120 determines the time that the first event is processed(step 220) by, for example, accessing local clock 140 to obtain the timeat substantially the same time that the first event is processed. Firstserver 120 updates the friends DB with a timestamp that is based on thetime obtained from local clock 140 (step 225), and which represents thetime that the first event happened, such as by being processed orexecuted. First server 120 sends a message that includes the first eventtimestamp to first user device 110, indicating that the processing ofthe first event is completed.

In some embodiments, the timestamp, also referred to as a PTS_(ts), is atwo-tuple (physical, logical) (or (p, l) for short) where the firstcomponent includes a representation of the physical time at which theevent occurred, such as the time obtained from local clock 140. Thesecond component is a logical sequence number which indicates anordering of events whose physical time representations are the same.Algorithm 2 depicts the PTS_(ts) update algorithm.

Algorithm 2 Time-Stamp Physical Time System update algorithm 1: var: 2:last:PTSC_(ts) ← 3: pts_api.PTS_API( ) 4: function SEND EVENT(s, snd(u),t) 5:  now ← pts_api.now( ) 6:  u.p ← max(s.last.p, now.p) 7:  u.l ←s.last.l 8:  snd(u) 9:  t.last.p ← u.p 10:  t.last.l ← u.l+1 11: endfunction 12: function RECEIVE EVENT(s, rcv(u), t) 13:  now ←pts_api.now( ) 14:  t.last.p ← max(u.ts.p, s.last.p, now.p) 15: t.last.1 ← max(u.ts.l, s.last.l) 16:  rcv(u) 17: end function 18:function INTERNAL EVENT(s, internal, t) 19:  now ← pts_api.now( ) 20: t.last.p ← max(s.last, now.p) 21:  t.last.l ← s.last.l + 1) 22: endfunction

The notation (s, snd(u), t) denotes a send event that takes the processfrom state s to state t; (s, internal, t) denotes an internal event; and(s, rcv(u), t) denotes a receive event that was received in state s andwas sent from the state u and moves the local process to state t. Forexample, the processing of the unfriend command at step 215, and thesending of the message that includes the first event timestamp at step230, moves the local process to a new state, e.g., from a state wherefirst user 105 and second user 155 are friends to a state where firstuser 105 and second user 155 are not friends.

Each time there is a send event, a PTS_(ts) timestamp can be created andsent along with the message that is sent. The physical component p ofthis timestamp can be the max( ) of the last received event's timestampand the current local clock value, whichever is greater. The logicalcomponent l of this timestamp can be the current logical sequencenumber. After the message is sent, the current logical sequence numberis increased by one and both the p and l components are saved as thelast timestamp.

At step 210, after receiving a message that includes the first eventtimestamp from first server 120 (step 230), first user device 110 sendsa message to second server 125 that includes the first event timestampto initiate a second event, such as the posting of the anti-governmentmessage of the example of the summary. Second server 125 processes thesecond event (step 260), by, for example, updating the posts DB with theanti-government message. Second server 125 determines the time that thesecond event is processed (step 265) by, e.g., accessing local clock 145to obtain the time at substantially the same time that the second eventis processed.

Because of clock error, local clocks 140 and 145 may output differenttimes. For ease of explanation, it is assumed that the clocks are off byten seconds. It is further assumed that local clock 140 of first server120 has the correct time, and that local clock 145 of second server 125is reporting a time that is ten seconds earlier than local clock 140. Inthis hypothetical, step 220, where the first event time is determined,occurs at 1:00:00 pm, and step 265, where the second event time isdetermined, occurs at 1:00:05 pm, both times with reference to ahypothetical perfect clock. Because local clock 140 has the correcttime, the time of the first event, as determined at step 220, will be1:00:00 pm. However, because local clock 145 is running ten secondsfast, the time of the second event, as determined at step 265, will be12:59:55 pm, which is ten seconds earlier than the actual time, which is1:00:05 pm. Even though the first event occurred before the secondevent, because of the error of the local clocks, the time reported bythe local clocks incorrectly indicates that the second event occurredfive seconds before the first event.

At step 270, second server 125 determines whether the first eventtimestamp indicates a time earlier than the second event time by, e.g.,comparing the time indicated by the first event timestamp and the timeindicated by the second event time, as obtained from local clock 145.With the above assumptions, second server 125 would determine that thefirst event time is not earlier than the second event time (step 270),and would update a timestamp value of a second database based on thefirst event timestamp (step 280). The updated timestamp value indicatesthe time that the second event occurred, and depending on the outcome ofstep 270, may be based on either the first event timestamp, or thesecond event time.

In some embodiments, the timestamp value is a two-tuple (p,l), and, inpreparation for updating the second database at step 280, p is set tothe p of PTS_(ts) (p,l) of the first event timestamp, and l is set to lof PTS_(ts) (p,l) of the first event timestamp, but incremented by one.The two-tuple can be implemented using a single numerical value. Forexample, the two-tuple can be implemented using a 64 bit number, wherethe first 52 bits are used for the physical timestamp, and the last 12bits are used for the logical value. In other embodiments, the timeportion of the timestamp value is set to a time later than the timeindicated by the first event timestamp, such as a time value that is oneunit of time later. When second server 125 determines that the firstevent time is earlier than the second event time (step 270), secondserver 125 updates the timestamp value of the second database based onthe second event time (step 275) by, e.g., setting the p of thetimestamp value two-tuple (p,l) to the second event time. In someembodiments, the l is incremented, while in others, the l is notincremented.

In the hypothetical discussed above where step 220, where the firstevent time is determined, occurs at 1:00:00 pm, and step 265, where thesecond event time is determined, occurs at 1:00:05 pm, the p oftimestamp value two-tuple (p,l) would be set to 1:00:00 pm. With thishypothetical, at step 270, second server 125 would determine that the pof the first event timestamp (e.g. 1:00:00 pm) is not earlier than thesecond event time (e.g. 12:59:59 pm). At step 280, the p of timestampvalue two-tuple (p,l) would be set to the p of PTS_(ts) (p,l) of firstevent timestamp, which is 1:00:00 pm. Further, the l of timestamp valuetwo-tuple (p,l) would be set to the l of PTS_(ts) (p,l) of first eventtimestamp, but incremented by one.

In some embodiments, the timestamp value of steps 275-280 is determinedin a different way. For example, second server 125 determines thetimestamp value by, e.g., setting the p of the timestamp value two-tuple(p,l) to the max( ) of the last known event's physical timestamp, thearriving message's physical timestamp, and/or the current local clock'stimestamp, whichever is greater. The logical component of the receptionof the message is taken as the max( ) of the received messages lcomponent an the last local event's l component. Finally whenever thereis an internal event, the event's physical component is tagged with themax( ) of the last known event's p component and the current local clockvalue, whichever is greater.

At step 240, second user device 115 processes a request whose outcomedepends on the order of the first and the second events (step 240).Returning to the example of the summary, the request can be thegovernment official attempting to read posts of his social mediaplatform friends. To process the request, second user device 115, orsome other system, needs to determine whether the anti-governmentmessage was posted before or after the activist unfriended thegovernment official. At step 245, second user device 115 requestsinformation regarding the first event from first server 120, and at step250, requests information regarding the second event from second server125. At step 235, first server 120 sends information regarding the firstevent that includes the first event timestamp to second user device 115.At step 285, second server 125 sends information regarding the secondevent that includes the timestamp value to second user device 115.

At step 255, second user device 115 determines the order of the eventsbased on the first event timestamp and the timestamp value. User device115 can determine the order by, for example, comparing the first eventtimestamp and the timestamp value. In some embodiments, the p of thePTS_(ts) (p,l) of the first event timestamp is compared to the p of thetimestamp value two-tuple (p,l). When p of the first event timestamp isearlier than p of the timestamp value, then second user device 115 candetermine that the first event occurred before the second event. When pof the first event timestamp is later than p of the timestamp value,then second user device 115 can determine that the second event occurredbefore the first event. When p of the first event timestamp is equal topof the timestamp value, then second user device 115 compares the lvalues of the two timestamps. When the l of the first event timestamp isless than the l of the timestamp value, then second user device 115 candetermine that the first event occurred before the second event. Whenthe l of the first event timestamp is greater than the l of thetimestamp value, then second user device 115 can determine that thefirst event occurred after the second event.

In the hypothetical discussed above, at step 255 second user device 115would compare the first event timestamp and the timestamp value todetermine the order of the events. First, the p's of the two timestampswould be compared. In this case, both p's are 1:00:00 pm, so thecomparison would determine that the two p's are equal. Next, the l's ofthe two timestamps would be compared. Because the l of the timestampvalue was set to the l of the first event timestamp, but incremented byone, the comparison will show that the l of the timestamp value isgreater than the l of first event timestamp. Accordingly, second userdevice 115 would determine that the second event occurred after thefirst event.

FIG. 3 is an diagram illustrating a sequence of events where some arecausally related, consistent with various embodiments. FIG. 3 depictsthe update procedure of some embodiments of the method of FIG. 2 for asequence of 7 events where e₃, e₄, and e₅ are causally related, and e₆and e₇ are causally related.

To order the events timestamped by the PTSC algorithm we use Definition2. For this definition and throughout this section we use the auxiliaryfunctions phys(e) to denote PTSCts(e).p (e.g., the p of PTSts (p,l)) andlgc(e) to denote PTSCts(e).1 (e.g., the l of PTSts (p,l)).

Definition 2. PTSC_(ts)(e)<PTSC_(ts)(f) can be defined as:

$\left\{ {\begin{matrix}{{{lgc}(e)} < {{lgc}(f)}} & {{{if}\mspace{14mu}{{phys}(e)}} = {{phys}(f)}} \\{{{phys}(e)} < {{phys}(f)}} & {otherwise}\end{matrix}\quad} \right.$

For the following pairs: e₁ and e₂, e₂ and e₃, e₃ and e₄, and e₆ and e₇,phys(e_(x))<phys(e_(x+1)), which means that the first element of thepair occurs before the second element of the pair. For e₄, e₅, and e₆,phys(e_(x))=phys(e_(x+1)), which means we must consider lgc(e_(x)) andlgc(e_(x+1)). For e₄ and e₅, lgc(e₄)<lgc(e₅), which means that e₄occurred before e₅. While lgc(e₆)=lgc(e₄), this is not an issue as theevents are not causally related, so an event order does not need to bedetermined between these two events. Where events e_(x) and e_(y) arecausally related, and phys(e_(x))=phys(e_(y)), a comparison oflgc(e_(x)) and lgc(e_(y)) can lead to a correct event order.

FIG. 4 is a high-level block diagram showing an example of a computersystem 400 that can represent any of the devices described above. In theexample of FIG. 4, the computer system 400 includes one or moreprocessors, memory, non-volatile memory, and an interface device.Various common components (e.g., cache memory) are omitted forillustrative simplicity. The computer system 400 is intended toillustrate a hardware device on which any of the components depicted inthe example of FIG. 1, such as first user device 110, second user device115, first server 120, or second server 125, (and any other componentsdescribed in this specification) can be implemented. The computer system400 can be of any applicable known or convenient type. The components ofthe computer system 400 can be coupled together via a bus or throughsome other known or convenient device.

The processor may be, for example, a conventional microprocessor such asan Intel Pentium microprocessor or Motorola power PC microprocessor. Oneof skill in the relevant art will recognize that the terms“machine-readable (storage) medium” or “computer-readable (storage)medium” include any type of device that is accessible by the processor.

The memory is coupled to the processor by, for example, a bus. Thememory can include, by way of example but not limitation, random accessmemory (RAM), such as dynamic RAM (DRAM) and static RAM (SRAM). Thememory can be local, remote, or distributed.

The bus also couples the processor to the non-volatile memory and driveunit. The non-volatile memory is often a magnetic floppy or hard disk, amagnetic-optical disk, an optical disk, a read-only memory (ROM), suchas a CD-ROM, EPROM, or EEPROM, a magnetic or optical card, or anotherform of storage for large amounts of data. Some of this data is oftenwritten, by a direct memory access process, into memory during executionof software in the computer 800. The non-volatile storage can be local,remote, or distributed. The non-volatile memory is optional becausesystems can be created with all applicable data available in memory. Atypical computer system will usually include at least a processor,memory, and a device (e.g., a bus) coupling the memory to the processor.

Software is typically stored in the non-volatile memory and/or the driveunit. Indeed, for large programs, it may not even be possible to storethe entire program in the memory. Nevertheless, it should be understoodthat for software to run, if necessary, it is moved to a computerreadable location appropriate for processing, and for illustrativepurposes, that location is referred to as the memory in this paper. Evenwhen software is moved to the memory for execution, the processor willtypically make use of hardware registers to store values associated withthe software, and local cache that, ideally, serves to speed upexecution. As used herein, a software program is assumed to be stored atany known or convenient location (from non-volatile storage to hardwareregisters) when the software program is referred to as “implemented in acomputer-readable medium.” A processor is considered to be “configuredto execute a program” when at least one value associated with theprogram is stored in a register readable by the processor.

The bus also couples the processor to the network interface device. Theinterface can include one or more of a modem or network interface. Itwill be appreciated that a modem or network interface can be consideredto be part of the computer system. The interface can include an analogmodem, isdn modem, cable modem, token ring interface, satellitetransmission interface (e.g. “direct PC”), or other interfaces forcoupling a computer system to other computer systems. The interface caninclude one or more input and/or output devices. The I/O devices caninclude, by way of example but not limitation, a keyboard, a mouse orother pointing device, disk drives, printers, a scanner, and other inputand/or output devices, including a display device. The display devicecan include, by way of example but not limitation, a cathode ray tube(CRT), liquid crystal display (LCD), or some other applicable known orconvenient display device. For simplicity, it is assumed thatcontrollers of any devices not depicted in the example of FIG. 4 residein the interface.

In operation, the computer system 400 can be controlled by operatingsystem software that includes a file management system, such as a diskoperating system. One example of operating system software withassociated file management system software is the family of operatingsystems known as Windows® from Microsoft Corporation of Redmond, Wash.,and their associated file management systems. Another example ofoperating system software with its associated file management systemsoftware is the Linux operating system and its associated filemanagement system. The file management system is typically stored in thenon-volatile memory and/or drive unit and causes the processor toexecute the various acts required by the operating system to input andoutput data and to store data in the memory, including storing files onthe non-volatile memory and/or drive unit.

Some portions of the detailed description may be presented in terms ofalgorithms and symbolic representations of operations on data bitswithin a computer memory. These algorithmic descriptions andrepresentations are the means used by those skilled in the dataprocessing arts to most effectively convey the substance of their workto others skilled in the art. An algorithm is here, and generally,conceived to be a self-consistent sequence of operations leading to adesired result. The operations are those requiring physicalmanipulations of physical quantities. Usually, though not necessarily,these quantities take the form of electrical or magnetic signals capableof being stored, transferred, combined, compared, and otherwisemanipulated. It has proven convenient at times, principally for reasonsof common usage, to refer to these signals as bits, values, elements,symbols, characters, terms, numbers, or the like.

It should be borne in mind, however, that all of these and similar termsare to be associated with the appropriate physical quantities and aremerely convenient labels applied to these quantities. Unlessspecifically stated otherwise as apparent from the following discussion,it is appreciated that throughout the description, discussions utilizingterms such as “processing” or “computing” or “calculating” or“determining” or “displaying” or the like, refer to the action andprocesses of a computer system, or similar electronic computing device,that manipulates and transforms data represented as physical(electronic) quantities within the computer system's registers andmemories into other data similarly represented as physical quantitieswithin the computer system memories or registers or other suchinformation storage, transmission or display devices.

The algorithms and displays presented herein are not inherently relatedto any particular computer or other apparatus. Various general-purposesystems may be used with programs in accordance with the teachingsherein, or it may prove convenient to construct more specializedapparatus to perform the methods of some embodiments. The requiredstructure for a variety of these systems will appear from thedescription below. In addition, the techniques are not described withreference to any particular programming language, and variousembodiments may thus be implemented using a variety of programminglanguages.

In alternative embodiments, the machine operates as a standalone deviceor may be connected (e.g., networked) to other machines. In a networkeddeployment, the machine may operate in the capacity of a server or aclient machine in a client-server network environment, or as a peermachine in a peer-to-peer (or distributed) network environment.

The machine may be a server computer, a client computer, a personalcomputer (PC), a tablet PC, a laptop computer, a set-top box (STB), apersonal digital assistant (PDA), a cellular telephone, a smartphone, aniPhone, a Blackberry, a processor, a telephone, a web appliance, anetwork router, switch or bridge, or any machine capable of executing aset of instructions (sequential or otherwise) that specify actions to betaken by that machine.

While the machine-readable medium or machine-readable storage medium isshown in an exemplary embodiment to be a single medium, the term“machine-readable medium” and “machine-readable storage medium” shouldbe taken to include a single medium or multiple media (e.g., acentralized or distributed database, and/or associated caches andservers) that store the one or more sets of instructions. The term“machine-readable medium” and “machine-readable storage medium” shallalso be taken to include any medium that is capable of storing, encodingor carrying a set of instructions for execution by the machine and thatcause the machine to perform any one or more of the methodologies of thepresently disclosed technique and innovation.

In general, the routines executed to implement the embodiments of thedisclosure, may be implemented as part of an operating system or aspecific application, component, program, object, module or sequence ofinstructions referred to as “computer programs.” The computer programstypically comprise one or more instructions set at various times invarious memory and storage devices in a computer, and that, when readand executed by one or more processing units or processors in acomputer, cause the computer to perform operations to execute elementsinvolving the various aspects of the disclosure.

Moreover, while embodiments have been described in the context of fullyfunctioning computers and computer systems, those skilled in the artwill appreciate that the various embodiments are capable of beingdistributed as a program product in a variety of forms, and that thedisclosure applies equally regardless of the particular type of machineor computer-readable media used to actually effect the distribution.

Further examples of machine-readable storage media, machine-readablemedia, or computer-readable (storage) media include but are not limitedto recordable type media such as volatile and non-volatile memorydevices, floppy and other removable disks, hard disk drives, opticaldisks (e.g., Compact Disk Read-Only Memory (CD ROMS), Digital VersatileDisks, (DVDs), etc.), among others, and transmission type media such asdigital and analog communication links.

Unless the context clearly requires otherwise, throughout thedescription and the claims, the words “comprise,” “comprising,” and thelike are to be construed in an inclusive sense, as opposed to anexclusive or exhaustive sense; that is to say, in the sense of“including, but not limited to.” As used herein, the terms “connected,”“coupled,” or any variant thereof, means any connection or coupling,either direct or indirect, between two or more elements; the coupling ofconnection between the elements can be physical, logical, or acombination thereof. Additionally, the words “herein,” “above,” “below,”and words of similar import, when used in this application, shall referto this application as a whole and not to any particular portions ofthis application. Where the context permits, words in the above DetailedDescription using the singular or plural number may also include theplural or singular number respectively. The word “or,” in reference to alist of two or more items, covers all of the following interpretationsof the word: any of the items in the list, all of the items in the list,and any combination of the items in the list.

The above detailed description of embodiments of the disclosure is notintended to be exhaustive or to limit the teachings to the precise formdisclosed above. While specific embodiments of, and examples for, thedisclosure are described above for illustrative purposes, variousequivalent modifications are possible within the scope of thedisclosure, as those skilled in the relevant art will recognize. Forexample, while processes or blocks are presented in a given order,alternative embodiments may perform routines having steps, or employsystems having blocks, in a different order, and some processes orblocks may be deleted, moved, added, subdivided, combined, and/ormodified to provide alternative or subcombinations. Each of theseprocesses or blocks may be implemented in a variety of different ways.Also, while processes or blocks are at times shown as being performed inseries, these processes or blocks may instead be performed in parallel,or may be performed at different times. Further any specific numbersnoted herein are only examples: alternative implementations may employdiffering values or ranges.

The teachings of the disclosure provided herein can be applied to othersystems, not necessarily the system described above. The elements andacts of the various embodiments described above can be combined toprovide further embodiments.

Any patents and applications and other references noted above, includingany that may be listed in accompanying filing papers, are incorporatedherein by reference. Aspects of the disclosure can be modified, ifnecessary, to employ the systems, functions, and concepts of the variousreferences described above to provide yet further embodiments of thedisclosure.

These and other changes can be made to the disclosure in light of theabove Detailed Description. While the above description describescertain embodiments of the disclosure, and describes the best modecontemplated, no matter how detailed the above appears in text, theteachings can be practiced in many ways. Details of the system may varyconsiderably in its implementation details, while still beingencompassed by the subject matter disclosed herein. As noted above,particular terminology used when describing certain features or aspectsof the disclosure should not be taken to imply that the terminology isbeing redefined herein to be restricted to any specific characteristics,features, or aspects of the disclosure with which that terminology isassociated. In general, the terms used in the following claims shouldnot be construed to limit the disclosure to the specific embodimentsdisclosed in the specification, unless the above Detailed Descriptionsection explicitly defines such terms. Accordingly, the actual scope ofthe disclosure encompasses not only the disclosed embodiments, but alsoall equivalent ways of practicing or implementing the disclosure underthe claims.

While certain aspects of the disclosure are presented below in certainclaim forms, the inventors contemplate the various aspects of thedisclosure in any number of claim forms. For example, while only oneaspect of the disclosure is recited as a means-plus-function claim under35 U.S.C. § 112(f), other aspects may likewise be embodied as ameans-plus-function claim, or in other forms, such as being embodied ina computer-readable medium. (Any claims intended to be treated under 35U.S.C. § 112(f) will begin with the words “means for”.) Accordingly, theapplicant reserves the right to add additional claims after filing theapplication to pursue such additional claim forms for other aspects ofthe disclosure.

The invention claimed is:
 1. A method for providing global clockconsistency across a distributed computing system, the distributedcomputing system including a plurality of computing machines, theplurality of computing machines including imperfect physical clocks, themethod comprising: obtaining a first timestamp of a first event, thefirst timestamp including: a physical component indicative of a physicaltime at which the first event occurred at a first computing machine; anda logical component indicative of an ordering of the first eventrelative to one or more other events; and sending a message to initiatea second event to a second computing machine, the message including thefirst timestamp, wherein the message causes the second computing machineto process the second event, wherein the first timestamp is usable bythe second computing machine to update a second timestamp indicative ofwhen the second event occurred, wherein the physical component of thefirst timestamp is a first physical component based on a first physicalclock at the first computing machine of the plurality of computingmachines, wherein the logical component of the first timestamp is afirst logical component, and wherein sending the message to initiate thesecond event causes the second computing machine of the plurality of theplurality of computing machines to: process the second event; andgenerate the second timestamp, wherein the second timestamp includes: asecond physical component indicative of a physical time at which thesecond event occurred, the second physical component based on a secondphysical clock at the second computing machine; and a second logicalcomponent indicative of an ordering of the second event relative to oneor more other events.
 2. The method of claim 1, wherein the physicalcomponent is based on a physical clock associated with one of theplurality of computing machines.
 3. The method of claim 1, wherein theordering of the first event is relative to one or more other eventsassociated with physical time representations indications that are thesame as the physical component of the first timestamp of the firstevent.
 4. The method of claim 1, further comprising: before sending themessage to initiate the second event, sending a message to initiate thefirst event; wherein the first timestamp is obtained in response tosending the message to initiate the first event.
 5. The method of claim1, wherein obtaining the first timestamp includes: receiving the firsttimestamp from the first computing machine of the plurality of computingmachines; wherein the first computing machine processed the first event;and wherein the physical component of the first timestamp is based on afirst physical clock at the first computing machine.
 6. The method ofclaim 5, wherein the second computing machine is one of the plurality ofcomputing machines.
 7. The method of claim 1, wherein the secondtimestamp is generated or updated by the second machine device based onthe first timestamp.
 8. The method of claim 1, wherein the secondlogical component is indicative of the ordering of the second eventrelative to the first event.
 9. The method of claim 1, wherein the firstevent is causally related to the second event.
 10. The method of claim1, further comprising: determining a correct order of the first event inrelation to another event based on a comparison between the firsttimestamp of the first event and a second timestamp of the other event.11. The method of claim 1, wherein the physical component of the firsttimestamp is a first physical component based on a first physical clockat the first computing machine of the plurality of computing machines;wherein the logical component of the first timestamp is a first logicalcomponent; the method further comprising: processing a request whoseoutcome depends on an ordering of the first event and a third event;requesting, from one or more of the plurality of computing machines,information regarding the third event; receiving, in response to therequest, the information regarding the third event, the informationincluding a timestamp of the third event, the timestamp including: asecond physical component indicative of a physical time at which thethird event occurred, the second physical component based on a secondphysical clock at the second computing machine of the plurality ofcomputing machines; and a second logical component indicative of anordering of the third event relative to one or more other events; anddetermining a correct order of the first event in relation to the thirdevent based on a comparison between the first timestamp of the firstevent and the timestamp of the third event.
 12. The method of claim 11,wherein determining the correct order includes: determining that thefirst physical component of the first timestamp is equal to the secondphysical component of the timestamp; and in response to determining thatthe first physical component of the first timestamp is equal to thesecond physical component of the timestamp: determining the correctorder based on a comparison between the first logical component of thefirst timestamp and the second logical component of the timestamp. 13.The method of claim 1, wherein the first timestamp includes a fixednumber of bits, wherein the physical component includes a first subsetof the fixed number of bits and where in the logical component includesa second subset of the fixed number of bits.
 14. The method of claim 1,wherein each of the plurality of computing machines is configured toattach hybrid timestamps with physical and logical components to events.15. The method of claim 1, wherein the distributed computing systemincludes a mechanism for the imperfect physical clocks among theplurality of computing machines to perform synchronization with areference time, and wherein said mechanism is capable of providing anerror bound along with each time measurement against the reference time.16. A distributed computing system capable of providing global clockconsistency, the distributed computing system including a plurality ofcomputing machines, one or more of the computing machines configured toperform operations comprising: obtaining a first timestamp of a firstevent, the first timestamp including: a physical component indicative ofa physical time at which the first event occurred at a first computingmachine; and a logical component indicative of an ordering of the firstevent relative to one or more other events; and sending a message toinitiate a second event to a second computing machine, the messageincluding the first timestamp, wherein the message causes the secondcomputing machine to process the second event, wherein the firsttimestamp is usable by the second computing machine to update a secondtimestamp indicative of when the second event occurred, wherein thephysical component of the first timestamp is a first physical componentbased on a first physical clock at the first computing machine of theplurality of computing machines, wherein the logical component of thefirst timestamp is a first logical component, and wherein sending themessage to initiate the second event causes the second computing machineof the plurality of the plurality of computing machines to: process thesecond event; and generate the second timestamp, wherein the secondtimestamp includes: a second physical component indicative of a physicaltime at which the second event occurred, the second physical componentbased on a second physical clock at the second computing machine; and asecond logical component indicative of an ordering of the second eventrelative to one or more other events.